package org.jetlinks.pro.messaging.kafka.impl;

import lombok.Generated;
import org.jetlinks.pro.datasource.AbstractDataSource;
import org.jetlinks.pro.datasource.DataSourceType;
import org.jetlinks.pro.messaging.kafka.KafkaDataSource;
import org.jetlinks.pro.messaging.kafka.command.CreateConsumer;
import org.jetlinks.pro.messaging.kafka.command.CreateProducer;
import org.springframework.boot.autoconfigure.kafka.KafkaProperties;

class DefaultKafkaDataSource extends AbstractDataSource<KafkaProperties> implements KafkaDataSource {

    public DefaultKafkaDataSource(String id, KafkaProperties config) {
        super(id, config);
        registerHandler(CreateConsumer.class, CreateConsumerHandler.INSTANCE);
        registerHandler(CreateProducer.class, CreateProducerHandler.INSTANCE);
    }

    @Override
    @Generated
    public DataSourceType getType() {
        return KafkaDataSource.type;
    }
}
